<!--
 * @Author: 王明明834578987 10266004+wang-mingming-834578987@user.noreply.gitee.com
 * @Date: 2024-08-29 10:59:23
 * @LastEditors: 王明明834578987 10266004+wang-mingming-834578987@user.noreply.gitee.com
 * @LastEditTime: 2024-09-11 14:59:16
 * @FilePath: \ft-apply-admin\src\views\applicationDetails\RTComponent\InterviewTache\Watting\WattingArrange.vue
 * @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
-->
<template>
  <RTHeader label="面试环节" :statusInfo="statusInfo"></RTHeader>
  <div class="btns">
    <Button  v-auth="'arriveInterview'" color="success" @click="arrival">到面</Button>
    <Button  v-auth="'editInterviewTime'" color="#5882d1" @click="changeDate">改期</Button>
    <Button  v-auth="'awaitInterviewWaive'" color="warning" @click="surrender">放弃</Button>
    <Button  v-auth="'offlineInterviewDetail'" color="#6C7DA8" @click="offline">线下到面</Button>
  </div>
</template>

<script setup lang='ts'>
import { ref } from "vue";
import { Button } from "@/components/Button";
import RTHeader from '../../RTHeader.vue';
import { comStores } from '@/store/common/comStore';
import { interview,offlineInterviewType } from "@/api/application-details/index.ts";
import { message } from "ant-design-vue";
const store = comStores()
const statusInfo = ref({
  status: "待面试",
  hr: "王xx",
  count: 1
})

const arrival = async() => {
  console.log('待面试 arrival');
  const { resumeId, processId } = store.currentResume;
  const { userName } = store.userInFor
  console.log('offline');
  let param = {
    "resumeId": resumeId,
    "processId": processId,
    "result": "通过",
    "operator": userName
  }
  const data=await interview(param);
  if (data && data.code == '10000') {
    message.success('操作成功');
    await store.getResumeInfo(resumeId)
  } else {
    message.error(data.msg)
  }
}
const emits =defineEmits(['surrender','changeDate'])
const surrender =()=>{
  console.log('surrender')
  emits('surrender','待面试')
}
const changeDate = () => {
  console.log('changeDate 待面试')
  emits('changeDate','待面试')
}

const offline=async()=>{
  const { resumeId, processId } = store.currentResume;
  const { userName } = store.userInFor
  let param = {
    resumeId: resumeId,
    operator: userName
  }
  const data=await offlineInterviewType(param);
  if (data && data.code == '10000') {
    message.success('操作成功');
    await store.getResumeInfo(resumeId)
  } else {
    message.error(data.msg)
  }
}

</script>
<style lang="less" scoped>
.btns {
  display: flex;
  gap: 8px;
  margin-top: 16px;
}
</style>